/**
 *
 */
package cn.dw.sg.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.dw.sg.domain.Authority;
import cn.dw.sg.service.AuthorityService;
import cn.dw.sg.service.RoleService;
import cn.dw.sg.service.impl.AuthorityServiceImpl;

/**
 * @author aubrey
 * @date  下午3:39:05
 * 
 */
@WebServlet("/authority")
public class AuthorityServlet extends HttpServlet {

	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		
		String roleId = req.getParameter("roleId");
		String menuId = req.getParameter("menuId");
		
		
		AuthorityService auth = new AuthorityServiceImpl();
		
		
		Authority a = new Authority();
		a.setRoleId(Integer.parseInt(roleId));
		a.setMenuId(Integer.parseInt(menuId));
		List<Authority> result = auth.query(a);
		
//		PrintWriter print = resp.getWriter();
//		print.write(result.toString());
		
		req.getRequestDispatcher("index.jsp").forward(req, resp);
		
		
//		resp.sendRedirect("index.jsp?id=2");
		
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	}
	
	
	
}
